@extends('admin.public')

@section('content')
    <div class="col-md-12">
        <section class="panel panel-default">
            <header class="panel-heading bg-light">
                <ul class="nav nav-tabs pull-left">
                    <li class="active">
                        <a href="#messages-1" data-toggle="tab">
                            <i class="icon-trash ico text-muted"></i>
                            清理数据
                        </a>
                    </li>
                    <li class="">
                        <a href="#profile-1" data-toggle="tab">
                            <i class="icon-settings ico text-muted"></i>
                            检测功能
                        </a>
                    </li>
                </ul>
                <div class="clearfix"></div>
            </header>
            <div class="panel-body">
                <div class="tab-content">
                    <div class="tab-pane active" id="messages-1">
                        <a href="{{ route('admin.clear.clear','delimage') }}" class="btn btn-danger ask"
                           data-ask="清除无用图片">
                            <i class="icon-trash ico"></i>
                            清除无用图片</a>
                        <a href="{{ route('admin.clear.clear','delfile') }}" class="btn btn-danger ask"
                           data-ask="清除缓存文件">
                            <i class="icon-trash ico"></i>
                            清除缓存文件
                        </a>
                        <a href="{{ route('admin.clear.clear','fill') }}" class="btn btn-danger ask" data-ask="清除填充信息">
                            <i class="icon-trash ico"></i>
                            清除填充信息
                        </a>
                        <a href="{{ route('admin.clear.clear','trash') }}" class="btn btn-danger ask" data-ask="清空回收站">
                            <i class="icon-trash ico"></i>
                            清空回收站
                        </a>
                        <a href="{{ route('admin.clear.clear','message') }}" class="btn btn-danger ask"
                           data-ask="清空在线留言">
                            <i class="icon-trash ico"></i>
                            清空在线留言
                        </a>
                    </div>
                    <div class="tab-pane" id="profile-1">
                        <a href="{{ route('admin.clear.debug','debug') }}" class="btn btn-danger ask"
                           data-ask="设置debug">
                            <i class="fa fa-bug"></i>
                            设置debug
                        </a>
                    </div>
                </div>
            </div>
        </section>
    </div>
@endsection

@section('css')
@endsection

@section('js')
    <script>
        $('.ask').click(function () {
            var ask = $(this).attr('data-ask');
            var num = parseInt(Math.random() * Math.pow(10, {{ config('app.clear_info_num') }}));
            var yes = prompt("请在下方输入框输入 " + num + ",以继续" + ask + "的操作!", "");
            if (yes == num) {
                return true;
            } else {
                alert('输入错误,终止' + ask + '的操作!');
                return false;
            }
        })
    </script>
@endsection
